//app.js
let config = require("./config/config.js"); //封装的request请求
let request = require("./utils/request.js") //封装的request请求

App({

  onShow(res) {
    if (res.scene === 1038) { // 场景值1038：从被打开的小程序返回
        const { appId, extraData } = res.referrerInfo
        if (appId == 'wxbcad394b3d99dac9') { // appId为wxbcad394b3d99dac9：从车主小程序跳转回来
            // TODO
            console.log('执行方法');
            return;
        }
    }
  },


  onLaunch: function () {
    let systemInfo = wx.getSystemInfoSync()
    let menuButton = wx.getMenuButtonBoundingClientRect()
    let paddingTop = systemInfo.statusBarHeight + (menuButton.height + (menuButton.top - systemInfo.statusBarHeight) * 2)
    let screenHeight = systemInfo.screenHeight
    let pageAllHeight = screenHeight * 2 - paddingTop * 2
    this.globalData.pageAllHeight = pageAllHeight
    wx.removeStorageSync('lmtc_start')
  },
  onHide() {
    wx.removeStorageSync('lmtc_start')
  },
  globalData: {
    userInfo: wx.getStorageSync('userInfo'),
    statusBarHeight: wx.getSystemInfoSync()['statusBarHeight'],
    screenHeight: wx.getSystemInfoSync()['screenHeight'],
    websocketUrl: config.webscoket_url,
    pageAllHeight: 0,
    indexJS:'', //当前页面
  }
})